package pure.ui.skins
{
	import pure.ui.manager.SkinManager;
	import flash.display.BitmapData;
	import flash.system.ApplicationDomain;
	
	/**
	 * 绝望UI皮肤基类
	 * @author Des
	 * 
	 * 单例:(制作新皮肤时，要注释皮肤的基本属性)
	 * 
	 *  // width:48
	 * 	// height:48
	 * 
	 *  public class NewToggleSkin 
	 *  {
	 * 		
	 *		public static function get instance():SelectableSkin
	 *		{
	 *			if (!_instance) {
	 *				_instance = new SelectableSkin('one','two','three','four');
	 *			}
	 *			return _instance;
	 *		}
	 * 
	 *		private static var _instance:SelectableSkin
	 *  }
	 */
	
public class Skin implements ISkin
{
	/**
	 * @param invalidation		当组件不可交互时的位图定义
	 */
	public function Skin(invalidation:String = null)
	{
		this.invalidation = invalidation;
	}
	
	
	public var invalidation:String;	// 组件不可交互

	
	/**
	 * 获取位图
	 * @param property		属性名称
	 **/
	public function getBitmap(property:String,currW:Number,currH:Number,app:ApplicationDomain=null):BitmapData
	{
		var definition:String = this[property];
		if (definition == null || definition == '')
		{
			return null;
		}
		return SkinManager.getBitmapBydefinition(definition, app);
	}
	
	/**
	 * 获取皮肤实例
	 * @param property		属性名称
	 **/
	public function getSkin(property:String):ISkin
	{
		return this[property] as ISkin;
	}


}
}